package com.lzw.breezeNovel.webApp.mapper.novel;


import com.lzw.breezeNovel.model.entity.pojo.novel.ReadRecord;
import com.lzw.breezeNovel.model.entity.query.SimplePage;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.mapper
 * @date 2025/3/2
 * @description 阅读记录mapper
 */
@Mapper
@SuppressWarnings("all")
public interface ReadRecordMapper {

    /**
     * 获取用户最近阅读的书籍
     * @param userId
     * @return
     */
    ReadRecord getLatestReadRecord(Long userId);

    /**
     * 获取用户阅读记录数量
     * @param userId
     * @return
     */
    int getReadRecordCount(Long userId);

    /**
     * 获取用户阅读记录列表
     * @param userId
     * @param simplePage
     * @return
     */
    List<ReadRecord> getReadRecordList(Long userId, SimplePage simplePage);

    /**
     * 删除阅读记录
     * @param userId
     * @param bookId
     */
    void deleteReadRecord(Long userId, Integer bookId);

    /**
     * 保存阅读记录
     * @param readRecord
     */
    void insert(ReadRecord readRecord);

    /**
     * 获取阅读记录
     * @param userId
     * @param bookId
     * @return
     */
    ReadRecord selectByUserIdAndBookId(Long userId, Integer bookId);

    /**
     * 更新阅读记录
     * @param readRecords
     */
    void update(ReadRecord readRecords);
}
